﻿using System.ComponentModel;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using Cms.Domain.Authentication;

namespace Cms.Web.UI
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    [ScriptService]
    public class Authentication : WebService
    {
        [WebMethod]
        public bool IsLoggedIn()
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
                return false;
            AuthenticatedUser user = Conversion.ToAuthenticatedUser(User.Identity.Name);
            return user.AdministratorID > 0;
        }
    }
}